<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:t="http//myfaces.apache.org/tomahawk">
<head>
<title>Find x in system of equations in max-min algebra</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<f:view>
	<h:outputText style="width: 600px;"
		value="MAX-MIN algebra EXAMPLE. Fill matrixes A and B or use random generator to fill these. Find vector x during the equation. Max generated number is now set to #{backingBean.maxNumber}." />
	<h:form id="form">
		<h:messages />
		<h:panelGrid id="grid" columns="2" style="margin-top: 10px;">
			<h:outputText id="maxNumber"
				value="Set maximum of random number here:" />
			<h:inputText id="inputMaxNumber" value="#{backingBean.maxNumber}"
				required="true" style="width: 5ex;">
				<f:convertNumber type="number" maxIntegerDigits="3" />
			</h:inputText>
			<h:commandButton id="btRandom" value="Random to A and B matrices"
				actionListener="#{backingBean.randomAB}" />
			<h:message id="message2" for="inputMaxNumber" />
		</h:panelGrid>
	</h:form>
	<h:form id="form2">
		<h:panelGrid id="gridForFinding" columns="1" style="margin-top: 10px;">
			<h:outputText value="A * x = B * x &nbsp;" style="font-size: x-large" />
			<h:outputText
				value="Question 1: Find vector x. To autofind vector X use this button." />
			<h:commandButton id="btFindX" value="Find vector with max X."
				actionListener="#{backingBean.findXMaximum}" />
		</h:panelGrid>
		<h:panelGrid id="matrix" columns="7"
			style="margin-top: 10px; width: 500px;">
			<h:outputText value="Matrix A"
				style="margin-left: 30px; font-size: x-large;" />
			<h:outputText value="" />
			<h:outputText value="x"
				style="margin-left: 30px; font-size: x-large;" />
			<h:outputText value="" />
			<h:outputText value="Matrix B"
				style="margin-left: 30px; font-size: x-large;" />
			<h:outputText value="" />
			<h:outputText value="x"
				style="margin-left: 30px; font-size: x-large;" />
			<h:panelGrid id="matrixA" columns="3"
				style="margin-top: 10px; width: 200px;">
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[0].value}"
					style="width: 5ex;" id="a00">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[1].value}"
					style="width: 5ex;" id="a01">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[2].value}"
					style="width: 5ex;" id="a02">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[0].value}"
					style="width: 5ex;" id="a10">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[1].value}"
					style="width: 5ex;" id="a11">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[2].value}"
					style="width: 5ex;" id="a12">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[0].value}"
					style="width: 5ex;" id="a20">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[1].value}"
					style="width: 5ex;" id="a21">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[2].value}"
					style="width: 5ex;" id="a22">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[0].value}"
					style="width: 5ex;" id="a30">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[1].value}"
					style="width: 5ex;" id="a31">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[2].value}"
					style="width: 5ex;" id="a32">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
			</h:panelGrid>
			<h:outputText value=" * &nbsp;" style="font-size: x-large" />
			<h:panelGrid id="rowsOfXMatrix" columns="1"
				style="margin-top: 10px; width: 70px; margin-left: 20px;">
				<h:outputText value="#{backingBean.xmaximum.rows[0].cols[0].value}"
					style="width: 5ex;" id="xmaximum00">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
				<h:outputText value="#{backingBean.xmaximum.rows[1].cols[0].value}"
					style="width: 5ex;" id="xmaximum10">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
				<h:outputText value="#{backingBean.xmaximum.rows[2].cols[0].value}"
					style="width: 5ex;" id="xmaximum20">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
			</h:panelGrid>
			<h:outputText value=" = " style="font-size: x-large" />
			<h:panelGrid id="rowsOfB" columns="3"
				style="margin-top: 10px; width: 200px; margin-left: 10px;">
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[0].value}"
					style="width: 5ex;" id="b00">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[1].value}"
					style="width: 5ex;" id="b01">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[2].value}"
					style="width: 5ex;" id="b02">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[1].cols[0].value}"
					style="width: 5ex;" id="b10">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[1].cols[1].value}"
					style="width: 5ex;" id="b11">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[1].cols[2].value}"
					style="width: 5ex;" id="b12">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[2].cols[0].value}"
					style="width: 5ex;" id="b20">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[2].cols[1].value}"
					style="width: 5ex;" id="b21">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[2].cols[2].value}"
					style="width: 5ex;" id="b22">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[3].cols[0].value}"
					style="width: 5ex;" id="b30">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[3].cols[1].value}"
					style="width: 5ex;" id="b31">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.matrixB.rows[3].cols[2].value}"
					style="width: 5ex;" id="b32">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
			</h:panelGrid>
			<h:outputText value=" * &nbsp;" style="font-size: x-large" />
			<h:panelGrid id="rowsOfXMatrix2" columns="1"
				style="margin-top: 10px; width: 70px; margin-left: 20px;">
				<h:outputText value="#{backingBean.xmaximum.rows[0].cols[0].value}"
					style="width: 5ex;" id="xmaximum002">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
				<h:outputText value="#{backingBean.xmaximum.rows[1].cols[0].value}"
					style="width: 5ex;" id="xmaximum102">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
				<h:outputText value="#{backingBean.xmaximum.rows[2].cols[0].value}"
					style="width: 5ex;" id="xmaximum202">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:outputText>
			</h:panelGrid>
		</h:panelGrid>
		<h:panelGrid id="gridForLowerBound" columns="2" style="margin-top: 10px;">
			<h:outputText value="lower bound (l) &nbsp;" style="font-size: x-large" />
			<h:panelGrid id="rowsWithLowerBound" columns="1"
				style="margin-top: 10px; width: 60px;">
				<h:inputText value="#{backingBean.lowerBound.rows[0].cols[0].value}"
					style="width: 5ex;" id="lb00" readonly="true">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.lowerBound.rows[1].cols[0].value}"
					style="width: 5ex;" id="lb10" readonly="true">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
				<h:inputText value="#{backingBean.lowerBound.rows[2].cols[0].value}"
					style="width: 5ex;" id="lb20" readonly="true">
					<f:convertNumber type="number" maxIntegerDigits="3" />
				</h:inputText>
			</h:panelGrid>
			<h:commandButton id="btFindXWithLowerBound" value="Find vector x with defined lower bound."
				actionListener="#{backingBean.findXWithLowerBound}" />
		</h:panelGrid>
	</h:form>
</f:view>
</body>
</html>
